import constants as con
import pygame

class Title(pygame.sprite.Sprite):
    title = None

    def __init__(self,parent):
        pygame.sprite.Sprite.__init__(self)

        if Title.title is None:
            Title.title  = con.load_image('title.png')

        self.parent = parent
        self.sprites = parent.sprites

        self.width = int(con.window_size[0] * 0.5)
        self.height = int(con.window_size[1] * 0.2)
        self.x = int(con.window_size[0] / 2) - int(self.width / 2)
        self.y = 0

        self.image = pygame.transform.scale(Title.title, (self.width, self.height))

        self.rect = pygame.Rect(self.x,self.y,self.width,self.height)

        self.sprites.add(self)

    def purge(self):
        self.sprites.remove(self)
                                            
